user_list = ["admin","morning","eight","Mary"]
pwd_list = ["1234","2234","3234","4234"]
# 检查一个用户名是否存在，存在返回下标，不存在返回-1
def check(name):
    for i in range(0, len(user_list)):
        if user_list[i] == name:
            return i
    return -1
#注册
def reg(name,pwd):
    if check(name) >= 0:
        print("用户名已存在！")
    else:
        user_list.append(name)
        pwd_list.append(pwd)
        print("注册成功！")
    print(user_list)
    print(pwd_list)
reg("zxc1","qazwer")
#登录
def login(name,pwd):
    index = check(name)
    if index >= 0:
        if pwd_list[index] == pwd:
            print("登录成功")
        else:
            print("密码错误")
    else:
        print("用户名错误")
login('zxc1','qazwer')



